<?php
class StubSchemaProvider{
	function getDatabases(){
		return array( new StubDatabase("1"), new StubDatabase("2") );
	}
}
class StubDatabase{
	protected $id;
	function __construct( $id ){
		$this->id = $id;
	}
	function getTables(){
		return array( new StubTable($this->id."1"), new StubTable($this->id."2") );
	}
}
class StubTable{
	protected $id;
	function __construct( $id ){
		$this->id = $id;
	}
	function getFields(){
		return array( new StubField($this->id."1"),new StubField($this->id."2") );
	}
	function getName(){
		return "my_table".$this->id;
	}
}
class StubField{
	protected $id;
	function __construct( $id ){
		$this->id = $id;
	}
	function getName(){
		return "my_field".$this->id;
	}
}

class Test_CV_ORM_Generator_SeparateFileStrategy extends UnitTestCase{
	function test_generation(){
		return;
		$pdo = new PDO("mysql://localhost","root");
		$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
		$pdo->setAttribute( PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC );

		$schema = new StubSchemaProvider();
		$schema = new CV_ORM_Schema_Reader_MySQL( $pdo );
		$schema = new CV_ORM_Schema_Reader_Filter( $schema, array('kalender') );
		//print_r($schema->getDatabaseNames());
		$writer = new CV_ORM_Schema_Writer_SeparateFile();
		$writer->write( $schema );
		spl_autoload_register( array($writer,'autoload') );
		$oa = new ObjectAccess_Events( $pdo );
		$events = $oa->getLastFive();
		//print_r($events);
	}
}